<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <script type="text/javascript" src="lib/jquery.js"></script>

    <title>Title</title>

    <style type="text/css">

        html,body{
            margin:0;
            padding:0;
        }


    </style>


</head>

<body>

    <span>78911111*****************</span>
    <ul id="list">
        <li>1</li>
        <li>2</li>
        <li>3</li>
    </ul>
    <div id="demo"></div>

    <input type="checkbox"><span>lisa</span>
    <input type="checkbox"><span>ffff</span>


<select class="form-stacked__input fluid js-fk_customer_address_third_level error" name="AddressForm[fk_customer_address_third_level]" id="AddressForm_fk_customer_address_third_level"><option value="">- Pilih Kota</option><option value="5890">Kisaran</option><option value="5891">Bandar Pasir Mandoge</option><option value="5892">Bandar Pulau</option><option value="5893">Pulau Rakyat</option><option value="5894">Sei Kepayang</option><option value="5895">Tanjung Balai</option><option value="5896">Simpang Empat-ASAHAN</option><option value="5897">Air Batu</option><option value="5898">Buntu Pane</option><option value="5899">Meranti</option><option value="5900">Air Joman</option><option value="5901">Aek Kuasan</option><option value="5902">Kisaran Barat</option><option value="5903">Kisaran Timur</option></select>

</body>


<script type="text/javascript">

    (function(callback){

        function distance(a,b){
            var x = a.clientX-b.clientX;
            var y = a.clientY-b.clientY;
            return Math.sqrt(x*x+y*y);
        }

        let init = 0;
        document.addEventListener('touchstart',function(e){
            if(e.targetTouches.length>=2){
                let xy = distance(e.targetTouches[0],e.targetTouches[1]);
                init = xy;
                document.getElementById('demo').innerText = xy;
            }
        })
        document.addEventListener('touchmove',function(e){
            if(e.targetTouches.length>=2){
                let xy = distance(e.targetTouches[0],e.targetTouches[1]);
                if(xy<init){
                    callback && callback('reduce',xy);
                    document.getElementById('demo').innerText = '-';
                }else{
                    callback && callback('add',xy);
                    document.getElementById('demo').innerText = '+';
                }

            }
        });

    })()

;(function(){

    var arr = [];
    var dom = $("select").find('option').each(function(index,item){
        arr.push($(item).text())
    })
    console.log(arr);

})


    (function(){

        var dom = document.getElementById('list').getElementsByTagName('li');
            for(var i=0;i<dom.length;i++){
                dom[i].onclick = (function(k){
                    return function(){
                        alert(k)
                    }
                })(i)
            }


        function Dog() {
            this.wow = function() {
                alert('wow');
            }
            this.yelp = function() {
                this.wow();
            }
        }

        function Dog2(){

            Dog.call(this);
            this.yelp = function(){
                var _this = this;
                setInterval(function(){
                    _this.wow();
                },1000)
            }
        }

        var dog = new Dog2();

        //dog.yelp();


        /*Object.prototype.cl = function(){
            var temp = this.constructor === Array ? [] : {}
            for(var i in this){
                temp[i] = typeof this[i] == 'object'? this[i].cl() : this[i];
            }

            return temp;
        }*/


        /*function demo(i,x,s){
            return i%x === 0 ? s : '';
        }

        function demo2(a,b,c){
            for(var i=1;i<=10;i++){
                var str =  demo(i, a, 'Fizz') + demo(i, b, 'Buzz') + demo(i, c, "Whizz");
                console.log((i + '').indexOf(a) !== -1 ? 'Fizz' : str == '' ? i : str)
            }
        }
        demo2(3,5,7)*/

        /*function arr(arr){
            var box = [];
            var a = {}
            while(true){
                if(box.length == arr.length){return box}
                var num = Math.floor(Math.random()*arr.length)
                if(!a[arr[num]]){
                    box.push(arr[num]);
                    a[arr[num]] = true;
                }
            }

        }
        alert(arr([1,3,5,4,8]))*/
    });

    (function(){
        var a = {
            name:'jack',
            age:11,
        }
        var b = {
            name:'jack2',
            sex:'男',
        }
        var result = $.extend({},a,b)
        //result.name = 'lisa';
        console.log(result)
    });

    /*$.ajax({
        type:'post',
        url:'//me.api.com/test.php',
        contentType:'application/json',
        data:JSON.stringify({a:1}),
        success:function(res){
            console.log(res.data)
        },
        error:function(er){
            console.log(er)
        }
    })*/


</script>
</html>

























